<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Controller extends CI_Controller {

	public function __construct(){
		parent::__construct();
		$this->db = $this->load->database ( "default", TRUE );//连接数据库
		$this->siteData = $this->db->get($this->db->dbprefix('site_settings'))->row_array();//读取dilicms配置属性
	}
	/*
	 * 判断用户是否存在
	 * */
	public function checkUser($username){
		$sql = "select *  from future_u_c_user where username = '{$username}'";
		$re = $this->db->query($sql)->row_array();
		if(empty($re)){
			return true;
		}else{
			return false;
		}
	}
	
	/**
	 * 登录检测
	 *
	 * @param string $id
	 * @param string $url
	 * @return boolean
	 */
	public function isLogin() {
		$this->load->library ( 'session' );
		$v = $this->session->userdata ( 'username' );
		if (empty ( $v )) {
			return FALSE;
		} else {
			$this->username = $v;
			return TRUE;
		}
	}
}